#include <cstdio>
#include <cstring>
 
int jieCheng[5000] = {0};
int jieChengLen = 0;

int mulData(int x[], int xlen, int k, int y[])
{
	int ylen = 0;
    int carry = 0;
    for ( int i = 0; i < xlen; i++ )
    {
        int s = x[i] * k + carry;
        y[ylen] = s % 10;
        ylen ++;
        carry = s / 10; 
    }
    
    while ( carry > 0 )
    {
        y[ylen] = carry % 10;
        ylen ++;
        carry = carry / 10;
    }
    return ylen;
}

int main()
{
	freopen("jc.in", "r", stdin);
    freopen("jc.out", "w", stdout);
	jieCheng[0] = 1;
    jieChengLen = 1;
    
    int n = 0;
    scanf("%d", &n);
    for ( int i = 2; i <= n; i++ ) {
		jieChengLen = mulData(jieCheng, jieChengLen, i, jieCheng);
    }
    int lastD = 0;
    int cnt[10] = {0};
	for ( int i = 0; i < jieChengLen; i++ ) {
    	if ( jieCheng[i] != 0 && lastD == 0 ) {
    		lastD = jieCheng[i];
    	}
    	int d = jieCheng[i];
    	cnt[d] ++;
    }
    printf("%d\n", lastD);
    for ( int i = 0; i < 10; i++ ) {
    	printf("%d ", cnt[i]);
    }
    return 0;
}
